background-process

Call multiple services in background in android

老子叫甜甜 提交于 2019-12-12 02:24:09
问题 I have to call multiple services in background for a project in android app. In each services i have to call separate web service and get some data and process it with local sqlite database. I am able to call each service separately and can manipulate its result with local database. But not able to call all services in a sequence. my code is as below: @Override public void onStart(Intent intent, int startid) { Toast.makeText(this, "My Service Started", Toast.LENGTH_LONG).show(); Timer timer =

background service for multitask downloader stops when close app from “recent apps”

末鹿安然 提交于 2019-12-12 02:23:15
问题 I have a downloader app project and I'm using a Service class for managing download tasks and showing notifications like this : the problem: when I close app from recent apps by swiping , the Service will be stop. I cant use startForeground for notifications , because I have multiple notifications in one service . and I like notify.setAutoCancel(true) works fine. here is AndroidManifest.xml code : <service android:name=".Downloader" android:exported="false" android:enabled="true" android

React-native background process(android) handling?

本小妞迷上赌 提交于 2019-12-12 02:08:07
问题 How to console.log() something periodically in the background process or when the app is terminated on android platform? 回答1: you need to create custom Java module which will run in the background. For example: @ReactMethod public void startTimeTasks(Integer delay1, Integer delay2) { if (timer != null) { timer.cancel(); timer.purge(); } timer = new Timer(); timer.schedule(new TimeTask(), delay1); timer.schedule(new TimeTask(), delay2); } @ReactMethod public void cancelTimeTasks() { if (timer

Background execution automatically stops after 3 minutes

帅比萌擦擦* 提交于 2019-12-12 00:45:56
问题 I wanted upload photos as background task but background execution stops automatically after 3 minutes. Code which I have done: - (void)applicationDidEnterBackground:(UIApplication *)application { UIApplication *app = [UIApplication sharedApplication]; bgTask = [app beginBackgroundTaskWithExpirationHandler:^{ //Stop upload call [app endBackgroundTask:bgTask]; bgTask = UIBackgroundTaskInvalid; }]; }} 回答1: I found that iOS puts strict limits on how long you can run. Specifically: When you move

how to play music using AVAudioPlayer when screen os locked

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-11 20:11:55
问题 i need to play a simple sound using AVAudioPlayer when screen is locked .How can I do that please help 回答1: This was answered here before. As the thing suggests you need to set your audio session as in this example UInt32 category = kAudioSessionCategory_MediaPlayback; OSStatus result = AudioSessionSetProperty(kAudioSessionProperty_AudioCategory, sizeof(category), &category); if (result){ DebugLog(@"ERROR SETTING AUDIO CATEGORY!\n"); } result = AudioSessionSetActive(true); if (result) {

NSException kills the app if raised in background

蹲街弑〆低调 提交于 2019-12-11 20:02:38
问题 I am performing some network related code. When the code starts executing and the user sends the app in background and that time if exception raise the app is killed. if exception is not raised app is not killed. Is it possible to stop/pause any kind of network activity? or a way to stop app from killing? UPDATE I am using matt gallahar (cocoa with love) written uncaughtexception handler. How do I cancel the request once it fired. The code for request is called in this function +(NSString*

Not receiving GCM notifications with app in background and content-available=1

元气小坏坏 提交于 2019-12-11 18:37:59
问题 I developing an Ionic 2 app and testing on Android emulator. When the app is in background and the notification has no title, no message and content-available=1 the notification should be sent directly to app notification handler. But its not happening. I can receive notifications with the app in foreground. If I have a title and a message I receive the notification in the notification area. But I need to send the notification directly to the app in silent mode, without pass by the

Running script in background using php curl

妖精的绣舞 提交于 2019-12-11 15:23:34
问题 I want to run a function as background process using curl. Below is my code. foreach ($iles $file=> $size) { $params ="file=$file&fullpath=$fullpath&minWidth=$minWidth"; $url = 'http://test.rul.com/file/listFiles?'.$params; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); $curled=curl_exec($ch); curl_close($ch); } } public function getlistFiles() { $fullpath = $_REQUEST['fullpath']; } but this curl is not running on background. how can I

Blackberry closing UiApplication Alternative Entry Point

左心房为你撑大大i 提交于 2019-12-11 12:27:35
问题 I have a requirement to have a background process using Application, while also having a UiApplication through an alternative entry point. Now, everything works great and I'm able to communicate between them fine, apart from when it comes to telling the UiApplication to close from the background process. I've tried a number of methods: UiApplication.getUiApplication().requestClose() doesn't work. I've tried setting a boolean value to true, which the UiApplication checks every second to see if

Sending SMS in background automatically in android

送分小仙女□ 提交于 2019-12-11 11:31:45
问题 I have developed an app for local people in my place to use the app in an emergency case. This app sends SMS automatically in the background every 15mins with their current location. This has been very useful for all the people in my place. Now after the new policy in effect for Send_SMS permission, I have been asked to remove send_sms permission. If I do that how do I send SMS automatically? The main idea of this App is that we don't need the internet. Can someone throw some idea on how to