receiver

Pass result from DeviceAdminReceiver back to calling activity

孤街浪徒 提交于 2019-12-23 04:33:30
问题 My activity (MyActivity.class) executes the method to set the screen lock as follow: startActivityForResult(Security.setLockscreen(getBaseContext()), 1001); Then my receiver class logs the change to the screen lock as follow: public class MyDeviceAdminReceiver extends DeviceAdminReceiver { @Override public void onPasswordChanged(Context context, Intent intent) { super.onPasswordChanged(context, intent); // pass result back to calling activity intent = new Intent(context, MyActivity.class);

Android - Bluetooth discovery doesn't find any device

和自甴很熟 提交于 2019-12-20 10:17:47
问题 I'm currently working on a little app to get started with the services that the Bluetooth Android API can provide. Edit -> Answer: It seems that the issue was due to the specific Nexus 5 devices. Seems like their bluetooth receiver doesn't work well. Solution below should work for other devices Remark: I’ve read the documentation here: http://developer.android.com/guide/topics/connectivity/bluetooth.html as well as the following source code of this tutorial http://www.londatiga.net/it

Android 5.0.2 - SMS Broadcast Receiver - can not get it working

ぐ巨炮叔叔 提交于 2019-12-18 07:06:37
问题 I am testing on Xiaomi Redmi Note 3 and what I need is very simple: * Register broadcast receiver for incoming text messages * Once message comes in, just read it It looks like I can not get receiver register no matter what I try. From the google docs, since 4.4 there should be no way for any app to swallow the event and every app listening should get a chance to get the event. I have tried all kind of combinations and googled pretty much everything. Could it be the Xiaomi phone issue? Here

Android DownloadManager get filename

主宰稳场 提交于 2019-12-17 18:17:14
问题 In my app you can download some files. I used the Android DownloadManager class for downloading. After the download is completed, it should show me a message that the file was downloaded. The problem is, there could be 2,3 or 4 downloads at the same time. My BroadcastReceiver code looks like this: receiver_complete = new BroadcastReceiver(){ @Override public void onReceive(Context context, Intent intent) { String action = intent.getAction(); if (action.equals(DownloadManager.ACTION_DOWNLOAD

Boost UDP multicast receiver: set_option: The requested address is not valid in its context

为君一笑 提交于 2019-12-14 03:25:09
问题 I am following Boost's UDP Time server tutorial here . I modify the code with these for predefined values: short multicast_port = 13; // (in class receiver) and in main(): //if (argc != 3) and the code for argv that follows are commented out receiver r(io_context, boost::asio::ip::make_address("127.0.0.1"), boost::asio::ip::make_address("127.0.0.1")); // This error is thrown: set_option: The requested address is not valid in its context I have tried "0.0.0.0" and "127.0.0.1" and other values.

MMS Android Receiver

北城以北 提交于 2019-12-12 02:02:13
问题 I can not download the data from the MMS center. Then try on http download data url that took out PduHeaders. But I returned IOException Time Out. i cannot download data from a URL GET request, but standart app dowload.(Hangouts) public class MMSReceiver extends BroadcastReceiver { Context context; ConnectivityManager manager; public void onReceive(final Context context, Intent intent) { this.context = context; Bundle bundle = intent.getExtras(); manager = (ConnectivityManager) context

launch hidden app when secret code is dialed

孤街醉人 提交于 2019-12-11 06:58:56
问题 my requirement is to launch an hidden app when a secret code is dailed. MainActivity.java public class MainActivity extends BroadcastReceiver { String dialed_number; @Override public void onReceive(Context context, Intent intent) { dialed_number = intent.getStringExtra(Intent.EXTRA_PHONE_NUMBER); if(dialed_number.equals("*0*1235#")) { Intent appIntent = new Intent(context, MainActivity.class); appIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(appIntent); setResultData

Calling registerReceiver from a DialogFragment

こ雲淡風輕ζ 提交于 2019-12-10 12:58:20
问题 EDIT I added this line: getActivity().registerReceiver(new BroadcastReceiver(){...}, new IntentFilter(SENT)); There is now a runtime error though, the error reads: 09-03 04:12:41.856: E/AndroidRuntime(1692): java.lang.IllegalStateException: Could not find a method sendMessage(View) in the activity class android.view.ContextThemeWrapper for onClick handler on view class android.widget.ImageView with id 'button_send' My question would be: Why would it be looking for the method in android.view

Detect day change event in broadcast receiver in android

北城余情 提交于 2019-12-06 08:44:37
问题 I want to implement a feature in android app which execute a particular code when ever there is a date change(at 00:00AM) even when my app is not running. 回答1: I might be late answering this question, but I personally faced the same problem. For day change, you can simply use a broadcast receiver with action "android.intent.action.DATE_CHANGED", and it will trigger whenever the date is changed (either implicitly or explicitly by user). I hope this will help someone who gets to here through

Android Intent Action 大全

被刻印的时光 ゝ 提交于 2019-12-05 08:27:33
1.Intent的用法: (1) Action跳转 1、 使用Action跳转,当程序AndroidManifest.xml中某一个 Activity的IntentFilter定义了包含Action,如果恰好与目标Action匹配,且其IntentFilter中没有定义其它的Type或Category过滤条件,那么就正好匹配了。如果手机中有两个以上的Action程序匹配,那么就会弹出一个对话可框来提示说明。例如打开一个网址,弹出可选对话框: Action 的值在Android中有很多预定义,如果想直接转到自己定义的Intent接收者,可以在接收者的IntentFilter 中加入一个自定义的Action值(同时要设定 Category值为"android.intent.category.DEFAULT"),在你的Intent中设定该值为Intent的 Action就直接能跳转到你自己的Intent接收者中,因为这个Action在系统中是唯一的。 2、 data/type,可以用Uri 来做为data,比如Uri uri = Uri.parse(“ http://blog.csdn.net/sunboy_2050 ” ); Intent i = new Intent(Intent.ACTION_VIEW, uri); 手机的Intent分发过程中,会根据“ http://blog