當前位置: 首頁>>代碼示例>>Java>>正文


Java Context.sendOrderedBroadcast方法代碼示例

本文整理匯總了Java中android.content.Context.sendOrderedBroadcast方法的典型用法代碼示例。如果您正苦於以下問題:Java Context.sendOrderedBroadcast方法的具體用法?Java Context.sendOrderedBroadcast怎麽用?Java Context.sendOrderedBroadcast使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.content.Context的用法示例。


在下文中一共展示了Context.sendOrderedBroadcast方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: KeyPressDownAndUp

import android.content.Context; //導入方法依賴的package包/類
public static void KeyPressDownAndUp(int key, Context context) {
    long eventtime = SystemClock.uptimeMillis() - 1;

    Intent downIntent = new Intent(Intent.ACTION_MEDIA_BUTTON, null);
    KeyEvent downEvent = new KeyEvent(eventtime, eventtime, KeyEvent.ACTION_DOWN, key, 0);
    downIntent.putExtra(Intent.EXTRA_KEY_EVENT, downEvent);
    context.sendOrderedBroadcast(downIntent, null);

    eventtime++;
    Intent upIntent = new Intent(Intent.ACTION_MEDIA_BUTTON, null);
    KeyEvent upEvent = new KeyEvent(eventtime, eventtime, KeyEvent.ACTION_UP, key, 0);
    upIntent.putExtra(Intent.EXTRA_KEY_EVENT, upEvent);
    context.sendOrderedBroadcast(upIntent, null);
}
 
開發者ID:mmlevin,項目名稱:C500Companion,代碼行數:15,代碼來源:C500Service.java

示例2: sendOrderedBroadcastAsUser

import android.content.Context; //導入方法依賴的package包/類
public void sendOrderedBroadcastAsUser(Intent intent, VUserHandle user, String receiverPermission,
                                       BroadcastReceiver resultReceiver, Handler scheduler, int initialCode,
                                       String initialData, Bundle initialExtras) {
    Context context = VirtualCore.get().getContext();
    if (user != null) {
        intent.putExtra("_VA_|_user_id_", user.getIdentifier());
    }
    // TODO: checkPermission
    context.sendOrderedBroadcast(intent, null/* permission */, resultReceiver, scheduler, initialCode, initialData,
            initialExtras);
}
 
開發者ID:7763sea,項目名稱:VirtualHook,代碼行數:12,代碼來源:VActivityManagerService.java

示例3: update

import android.content.Context; //導入方法依賴的package包/類
public static void update(Context context, String[] packages, boolean add) {
    if (packages == null || packages.length == 0) {
        return;
    }
    Intent intent = new Intent(PreventIntent.ACTION_UPDATE_PREVENT, Uri.fromParts(PreventIntent.SCHEME, context.getPackageName(), null));
    intent.setFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY);
    intent.putExtra(PreventIntent.EXTRA_PACKAGES, packages);
    intent.putExtra(PreventIntent.EXTRA_PREVENT, add);
    context.sendOrderedBroadcast(intent, PreventIntent.PERMISSION_SYSTEM, new PreventListReceiver(), null, 0, null, null);
}
 
開發者ID:brevent,項目名稱:prevent,代碼行數:11,代碼來源:PreventUtils.java

示例4: sendKeyPressBroadcastParcelable

import android.content.Context; //導入方法依賴的package包/類
public void sendKeyPressBroadcastParcelable(Context context, int action, int keycode, String packageName) {
    Intent intent = new Intent(Intent.ACTION_MEDIA_BUTTON);
    intent.putExtra(Intent.EXTRA_KEY_EVENT, new KeyEvent(0, 0, action, keycode, 0));
    if (packageName != null)
        intent.setPackage(packageName);

    context.sendOrderedBroadcast(intent, null);
}
 
開發者ID:TheAndroidMaster,項目名稱:MediaNotification,代碼行數:9,代碼來源:ActionReceiver.java

示例5: rewriteNumber

import android.content.Context; //導入方法依賴的package包/類
/**
 * Rewrite a number using a given plugin.
 * Warning this should never be done on main thread otherwise will always fail due to thread issues.
 * 
 * @param context The application context to use to talk to plugin
 * @param componentName The fully qualified component name of the plugin
 * @param number The number to rewrite
 */
public static String rewriteNumber(Context context, final String componentName, String number) {
    ComponentName cn = ComponentName.unflattenFromString(componentName);

    Intent it = new Intent(SipManager.ACTION_REWRITE_NUMBER);
    it.putExtra(Intent.EXTRA_PHONE_NUMBER, number);
    it.setComponent(cn);
    
    OnRewriteReceiver resultTreater = new OnRewriteReceiver(number);
    context.sendOrderedBroadcast(it, permission.PROCESS_OUTGOING_CALLS, resultTreater, null,
            Activity.RESULT_OK, null, null);
    
    return resultTreater.getResult();
}
 
開發者ID:treasure-lau,項目名稱:CSipSimple,代碼行數:22,代碼來源:RewriterPlugin.java

示例6: sendKeyPressBroadcastString

import android.content.Context; //導入方法依賴的package包/類
public void sendKeyPressBroadcastString(Context context, int keycode, String packageName) {
    Intent intent = new Intent("com.android.music.musicservicecommand");
    switch (keycode) {
        case KeyEvent.KEYCODE_MEDIA_PREVIOUS:
            intent.putExtra("command", "previous");
            break;
        case KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE:
            intent.putExtra("command", "togglepause");
            break;
        case KeyEvent.KEYCODE_MEDIA_PAUSE:
            intent.putExtra("command", "pause");
            break;
        case KeyEvent.KEYCODE_MEDIA_PLAY:
            intent.putExtra("command", "play");
            break;
        case KeyEvent.KEYCODE_MEDIA_NEXT:
            intent.putExtra("command", "next");
            break;
        case KeyEvent.KEYCODE_MEDIA_STOP:
            intent.putExtra("command", "stop");
            break;
        default:
            return;
    }

    if (packageName != null)
        intent.setPackage(packageName);

    context.sendOrderedBroadcast(intent, null);
}
 
開發者ID:TheAndroidMaster,項目名稱:MediaNotification,代碼行數:31,代碼來源:ActionReceiver.java

示例7: a

import android.content.Context; //導入方法依賴的package包/類
private void a(Context context, String str, String str2, String str3) {
    z.b();
    Intent intent = new Intent(z[3]);
    intent.putExtra(z[5], str3);
    intent.putExtra(z[2], str2);
    intent.putExtra(z[4], str);
    intent.putExtra(z[1], 1);
    intent.addCategory(str2);
    context.sendOrderedBroadcast(intent, str2 + z[0]);
    z.b();
}
 
開發者ID:JackChan1999,項目名稱:letv,代碼行數:12,代碼來源:h.java

示例8: broadCastBookDeleted

import android.content.Context; //導入方法依賴的package包/類
public static void broadCastBookDeleted(int bookId, Context context) {
    Intent bookDeleteBroadCast =
            new Intent(BROADCAST_ACTION)
                    .putExtra(DownloadsConstants.EXTRA_DOWNLOAD_STATUS, DownloadsConstants.STATUS_NOT_DOWNLOAD)
                    .putExtra(DownloadsConstants.EXTRA_DOWNLOAD_BOOK_ID, bookId);
    context.sendOrderedBroadcast(bookDeleteBroadCast, null);
}
 
開發者ID:fekracomputers,項目名稱:IslamicLibraryAndroid,代碼行數:8,代碼來源:BooksInformationDbHelper.java

示例9: refreshBooksDbWithDirectory

import android.content.Context; //導入方法依賴的package包/類
/**
 * Scan the program directory and check each book data base file against the StoredBooks Database
 *
 * @return true if the directory  already exist and files were refreshed , false if the directory didn't exist or was empty in yhis case the directory is created
 */

public void refreshBooksDbWithDirectory(Context context) {
    SQLiteDatabase db = getWritableDatabase();
    ContentValues contentValues = new ContentValues();
    contentValues.put(BooksInformationDBContract.StoredBooks.COLUMN_NAME_FILESYSTEM_SYNC_FLAG,
            VALUE_FILESYSTEM_SYNC_FLAG_NOT_PRESENT);
    db.update(BooksInformationDBContract.StoredBooks.TABLE_NAME,
            contentValues, null, null);


    File booksDir = new File(StorageUtils.getIslamicLibraryShamelaBooksDir(context));
    if (!(booksDir.exists() && booksDir.isDirectory())) {
        booksDir.mkdirs();
    } else {
        String[] files = booksDir.list();
        if (files.length == 0) {
            return;
        }

        db.beginTransaction();
        try {
            for (String file : files) {
                String fullFilePath = booksDir + File.separator + file;

                //validate file name against <integer>.sqlite
                Matcher matcher = uncompressedBookFileRegex.matcher(file);
                if (matcher.matches()) {
                    int book_id = Integer.parseInt(matcher.group(1));
                    checkFileInDbOrInsert(db, book_id, context, fullFilePath);
                } else {
                    Matcher compressedMatcher = compressedBookFileRegex.matcher(file);
                    if (compressedMatcher.matches()) {
                        int bookId = Integer.parseInt(compressedMatcher.group(1));

                        Intent localIntent =
                                new Intent(BROADCAST_ACTION)
                                        // Puts the status into the Intent
                                        .putExtra(EXTRA_DOWNLOAD_STATUS, DownloadsConstants.STATUS_WAITING_FOR_UNZIP)
                                        .putExtra(DownloadsConstants.EXTRA_DOWNLOAD_BOOK_ID, bookId);
                        context.sendOrderedBroadcast(localIntent, null);

                        Intent serviceIntent = new Intent(context, UnZipIntentService.class);
                        serviceIntent.putExtra(UnZipIntentService.EXTRA_FILE_PATH, fullFilePath);
                        context.startService(serviceIntent);
                        // Broadcasts the Intent to receivers in this app.

                    }
                }
            }
            db.setTransactionSuccessful();
        } finally {
            db.endTransaction();
        }

        //delete book entries that doesn't have files in file system
        db.delete(BooksInformationDBContract.StoredBooks.TABLE_NAME,
                BooksInformationDBContract.StoredBooks.COLUMN_NAME_FILESYSTEM_SYNC_FLAG + "=?",
                new String[]{String.valueOf(BooksInformationDBContract.StoredBooks.VALUE_FILESYSTEM_SYNC_FLAG_NOT_PRESENT)}
        );

    }
}
 
開發者ID:fekracomputers,項目名稱:IslamicLibraryAndroid,代碼行數:68,代碼來源:BooksInformationDbHelper.java

示例10: broadCastDownloadCanceled

import android.content.Context; //導入方法依賴的package包/類
public static void broadCastDownloadCanceled(Context context, long bookId) {
    BooksInformationDbHelper instance = BooksInformationDbHelper.getInstance(context);
    if (instance != null) {
        Intent bookDeleteBroadCast =
                new Intent(BROADCAST_ACTION)
                        .putExtra(EXTRA_DOWNLOAD_STATUS, STATUS_NOT_DOWNLOAD)
                        .putExtra(EXTRA_DOWNLOAD_BOOK_ID, (int) instance
                                .getBookIdByDownloadId(bookId)
                        )
                        .putExtra(DownloadsConstants.EXTRA_DOWNLOAD_FAILLED_REASON, DownloadsConstants.REASON_CANCELED_BY_USER);
        context.sendOrderedBroadcast(bookDeleteBroadCast, null);
    }
}
 
開發者ID:fekracomputers,項目名稱:IslamicLibraryAndroid,代碼行數:14,代碼來源:LocalDownloadBroadCastReciver.java

示例11: broadCastBookInformationDownloadCanceled

import android.content.Context; //導入方法依賴的package包/類
public static void broadCastBookInformationDownloadCanceled(Context context, long id) {
    Intent ftsIndexingEndedBroadCast =
            new Intent(BROADCAST_ACTION)
                    .putExtra(EXTRA_DOWNLOAD_STATUS, DownloadsConstants.STATUS_BOOKINFORMATION_FAILED)
                    .putExtra(DownloadsConstants.EXTRA_DOWNLOAD_FAILLED_REASON, DownloadsConstants.REASON_CANCELED_BY_USER);
    context.sendOrderedBroadcast(ftsIndexingEndedBroadCast, null);
}
 
開發者ID:fekracomputers,項目名稱:IslamicLibraryAndroid,代碼行數:8,代碼來源:LocalDownloadBroadCastReciver.java

示例12: broadCastBookDownloadFailed

import android.content.Context; //導入方法依賴的package包/類
public static void broadCastBookDownloadFailed(int bookId, String reason, Context context) {
    Timber.e("Download Failed :" + reason);
    BooksInformationDbHelper storedBooksDatabase = BooksInformationDbHelper.getInstance(context);
    if (storedBooksDatabase != null) {
        storedBooksDatabase.deleteBookFromStoredBooks(bookId, context);
    }

    Intent bookDeleteBroadCast =
            new Intent(BROADCAST_ACTION)
                    .putExtra(DownloadsConstants.EXTRA_DOWNLOAD_STATUS, DownloadsConstants.STATUS_NOT_DOWNLOAD)
                    .putExtra(DownloadsConstants.EXTRA_DOWNLOAD_BOOK_ID, bookId)
                    .putExtra(DownloadsConstants.EXTRA_DOWNLOAD_FAILLED_REASON, reason);
    context.sendOrderedBroadcast(bookDeleteBroadCast, null);

}
 
開發者ID:fekracomputers,項目名稱:IslamicLibraryAndroid,代碼行數:16,代碼來源:BookDownloadCompletedReceiver.java

示例13: sendBookDownloadStatusChangeBroadCast

import android.content.Context; //導入方法依賴的package包/類
/**
 * @param context
 * @param bookId               the book id to broadCast download progress with
 * @param localBroadcastStatus one of {@link DownloadsConstants#STATUS_DOWNLOAD_COMPLETED} ,
 *                             {@link DownloadsConstants#STATUS_DOWNLOAD_COMPLETED}
 */
public static void sendBookDownloadStatusChangeBroadCast(Context context, int bookId, int localBroadcastStatus) {
    Intent localIntent =
            new Intent(BROADCAST_ACTION)
                    // Puts the status into the Intent
                    .putExtra(EXTRA_DOWNLOAD_STATUS, localBroadcastStatus)
                    .putExtra(DownloadsConstants.EXTRA_DOWNLOAD_BOOK_ID, bookId);

    // Broadcasts the Intent to receivers in this app.
    context.sendOrderedBroadcast(localIntent, null);
}
 
開發者ID:fekracomputers,項目名稱:IslamicLibraryAndroid,代碼行數:17,代碼來源:BookDownloadCompletedReceiver.java

示例14: sendOrderedBroadcastAsUser

import android.content.Context; //導入方法依賴的package包/類
public void sendOrderedBroadcastAsUser(Intent intent, VUserHandle user, String receiverPermission,
                                       BroadcastReceiver resultReceiver, Handler scheduler, int initialCode,
                                       String initialData, Bundle initialExtras) {
    Context context = VirtualCore.get().getContext();
    intent.putExtra("_VA_|_user_id_", user.getIdentifier());
    // TODO: checkPermission
    context.sendOrderedBroadcast(intent, null/* permission */, resultReceiver, scheduler, initialCode, initialData,
            initialExtras);
}
 
開發者ID:codehz,項目名稱:container,代碼行數:10,代碼來源:VActivityManagerService.java

示例15: fetchAccounts

import android.content.Context; //導入方法依賴的package包/類
public static void fetchAccounts(Context context, K9AccountReceptor receptor) {
    Intent accountFetchIntent = new Intent();
    accountFetchIntent.setAction(K9RemoteControl.K9_REQUEST_ACCOUNTS);
    AccountReceiver receiver = new AccountReceiver(receptor);
    context.sendOrderedBroadcast(accountFetchIntent, K9RemoteControl.K9_REMOTE_CONTROL_PERMISSION, receiver, null, Activity.RESULT_OK, null, null);
}
 
開發者ID:philipwhiuk,項目名稱:q-mail,代碼行數:7,代碼來源:K9RemoteControl.java


注:本文中的android.content.Context.sendOrderedBroadcast方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。