broadcast

Android - how to receive broadcast intents ACTION_SCREEN_ON/OFF?

99封情书 提交于 2019-12-17 00:47:49
问题 <application> <receiver android:name=".MyBroadcastReceiver" android:enabled="true"> <intent-filter> <action android:name="android.intent.action.ACTION_SCREEN_ON"></action> <action android:name="android.intent.action.ACTION_SCREEN_OFF"></action> </intent-filter> </receiver> ... </application> MyBroadcastReceiver is set just to spit foo to the logs. Does nothing. Any suggestions please? Do I need to assign any permissions to catch the intent? 回答1: I believe that those actions can only be

Android - how to receive broadcast intents ACTION_SCREEN_ON/OFF?

拟墨画扇 提交于 2019-12-17 00:47:05
问题 <application> <receiver android:name=".MyBroadcastReceiver" android:enabled="true"> <intent-filter> <action android:name="android.intent.action.ACTION_SCREEN_ON"></action> <action android:name="android.intent.action.ACTION_SCREEN_OFF"></action> </intent-filter> </receiver> ... </application> MyBroadcastReceiver is set just to spit foo to the logs. Does nothing. Any suggestions please? Do I need to assign any permissions to catch the intent? 回答1: I believe that those actions can only be

Perform long running operations when receiving SMS on API < 21

戏子无情 提交于 2019-12-13 20:24:11
问题 I'm building an app that will listen for incoming SMS messages, perform some potentially long running operations and send back a reply if some conditions are met. I've got the listening part working using a BroadcastReceiver , but I'm not sure how/where to perform the potentially long running operations. The Android Developer Documentation states that After onReceive(), the system can kill the process at any time to reclaim memory, and in doing so, it terminates the spawned thread running in

UDP broadcast in C

回眸只為那壹抹淺笑 提交于 2019-12-13 11:50:45
问题 When I broadcast a message by the code below, the server on the host machine also receive the message, how can I prevent host machine to receive the message that it sends? Is it possible to change something on the code or would it be better to use something like if (strcmp(hostIP == IP_of_the_package) == 0) { <discard the msg>} ? the host machine gets IP from DHCP, how can I define hostIP as a variable and How can I extract IP addr of the packet ? void boardcast_msg(char *mess){ int sock;

Is it possible to resend SMS_RECEIVED broadcast?

╄→尐↘猪︶ㄣ 提交于 2019-12-13 08:45:42
问题 I want to resend received SMS_RECEIVED broadcast. I've find example here: http://blog.dev001.net/post/14085892020/android-generate-incoming-sms-from-within-your-app and make it by analogy: boolean received=false; private BroadcastReceiver broadcastReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { if(intent.getAction().equals("android.provider.Telephony.SMS_RECEIVED")) { if(!received) { received=true; Bundle pudsBundle = intent.getExtras();

AngularJS and typescript broadcast

半腔热情 提交于 2019-12-13 07:30:02
问题 I have following problem. I want to broadcast array of albums to another controller. Structure of my controllers : Parent - multimediaController, child - multimediaAlbumController. I am sending variable, but i cannot receive i, don't know why actually.. multimediaController.ts export class MultimediaController { $scope; static $inject = ['$scope']; constructor($scope){ this.$scope = $scope; } changeAlbum(){ this.$scope.$broadcast('prod', console.log("sending") ); } } multimediaAlbumController

How to use $q to get a promise from a $broastcast in angularJS

旧城冷巷雨未停 提交于 2019-12-13 07:07:35
问题 Right now my controller code looks like this: $scope.spAPI.load(id).then(function(result){ var deferred = $q.defer(); if(result !== undefined){ deferred.resolve($rootScope.$broadcast("onSpLoaded", result)); } return deferred.promise; }).then(function(success){ $scope.modalInstance = $modal.open({ ... }); }); I want the modal instance to be opened AFTER the broadcasts are processed. Is there a way to do this? Update: I was thinking about this problem backwards. I meant to do the broadcast

Cursor is Returning zero when called from Broadcast Receiver class

戏子无情 提交于 2019-12-13 04:56:34
问题 I am getting the cursor value zero when i access it from Broadcast Receiver class , this is the code which i have use to access value from database public Cursor select_in(String num) { final Cursor cur= db.rawQuery("SELECT incoming FROM contactlist WHERE number=\""+num+"\"",null); return cur; } and this is how I call the function from my Broadcast Receiver Class and i have passed the context of OnReceive Method. openhelper=new OpenHelper(context); this.db=openhelper.getWritableDatabase();

Is it possible starting Android Service and Broadcast when app did not run before

泪湿孤枕 提交于 2019-12-13 04:13:10
问题 If my app runs once, service can start and request to server on background. But when app did not run before, service could not start. Is it possible starting service even that app have not runned before. Actually what I want to do is that phone can send request to server for once without even runned before. When request sended, it will be activation. Later request is not to require. 回答1: No, it isn't possible. When your app is getting installed for the first time OR was force-closed by the

how to get notification (broadcast, intent) on browser download completion in android

做~自己de王妃 提交于 2019-12-13 03:44:13
问题 how to be notified (via some broadcast or intent) on a completion of a download initiated by user from web browser and other apps? (like email client, bluetooth, etc). I need this as I want to perform some action on each newly file downloaded by the user. It seems to me that this is possible as some antivirus apps do similar things. I tried to use broadcast receiver with intent filter set to DownloadManager.ACTION_DOWNLOAD_COMPLETE action, but this way I get notified only about downloads from