当前位置: 首页>>代码示例>>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;未经允许,请勿转载。