ionic 4 insert mode picture in picture for Android - ionic4

i am doing an app for Android and IOS. For IOS works well background geolocation , but for Android, the system kill the process after 5 min. I would like to implement mode pip but i don't find documentation about it.

What specific plugins are you using ?
And show us your AndroidManifest.xml
From : https://developer.android.com/guide/topics/ui/picture-in-picture
An activity can enter PIP mode when the user taps the home or recents
button to choose another app. (This is how Google Maps continues to
display directions while the user runs another activity at the same
time.)
You need to declare this :
<activity android:name="Activity"
android:supportsPictureInPicture="true"
</activity>
If you want your user entering in pip mode if he user presses the home or recents button, you have to override onUserLeaveHint() method in Activity.java with this:
#Override
public void onUserLeaveHint () {
if (iWantToBeInPipModeNow()) {
enterPictureInPictureMode();
}
}

Related

React native AppState "change" event not triggered by Android 12 Task Manager

Our react-native 0.66 Android app has an AppState change handler which is called when the app goes into the background / foreground...
import {AppState} from 'react-native';
...
this.changeUnsubscribe = AppState.addEventListener('change', this.handleChange)
...
handleChange(nextAppState) { console.log(`App state changed to: ${nextAppState}`) }
Works perfectly on Android 10. However on Android 12, the change event isn't happening when the user brings up the Task Manager.
Instead the event happens when you swipe up the app in the Task Manager (to close the app).
Unfortunately that causes a problem: It seems Android 12 limits the amount of activity you can perform as the app is closing. We're trying to save user data when the app goes into the background, and it's not always managing it. Pre-Android 12 our app managed it fine.
I can't find any mention of this new behaviour in the react-native or Android docs. Any tips anyone?
Answering my own question, hope it helps others:
For react-native v0.66 on Android 12 (may be the case for other versions): The system Task Manager no longer triggers the AppState change event.
It now triggers an AppState blur event. Returning to the app triggers a focus event. The AppState currentState will continue to be active while Task Manager is in the foreground.

DeviceMotion Expo iOS13

I’m working on an VR app using Expo and a-frame with a webview. Everything worked well with iOS12 but I have some problems since I updated to iOS13 and SDK35. When I start the webview, it is impossible to use the VR mode, the scene can only be moved if the user is manually swiping the screen.
After some research, I found that iOS13 requires an user gesture for using the device motion:
https://github.com/aframevr/aframe/issues/4277
I looked in the Expo doc but the Permissions doesn’t seem to handle the DeviceMotion permission (and the DeviceMotion page only says we can check if it’s enabled or not). Is there any way to solve this ?
Thanks in advance
You can use react-native-gesture-handler
You can run expo install react-native-gesture-handler
You can use this if you want to solve the problem of gestures. The rights to gestures appear to be missing from the document.
Example
import { TapGestureHandler, RotationGestureHandler } from 'react-native-gesture-handler';
class ComponentName extends Component {
render () {
return (
<TapGestureHandler>
<RotationGestureHandler>
...
</RotationGestureHandler>
</TapGestureHandler>
);
}
}
Read the react-native-gesture-handler docs for more information on the API and usage.

How to make Chrome on Android launch my image picker rather than the system UI's in React Native?

My app is a custom image picker written in React Native using Expo, that lets a user select a particular image for uploading. When a user presses an Upload button in any third-part Web page, I want my app to open rather than the standard Android file picker dialog.
Is this possible? I'm only interested in Android at the moment. I've looked at Expo's ImagePicker, but this launches the standard Android System UI in response to a call from an app. In contrast, I need my app to open, not ImagePicker, in response to a user's click on a file upload button in a Web page.
ContentProviders looks like a promising approach, but I can't see how to use it in Expo, and I'm not sure if this is the right approach anyway.
Intents all seem to load the standard system UI image picker.
Is what I want possible, and if so, what approach should I use to achieve it?

Drag and drop to Spotify app icon

I'm making a Spotify app and I want to be able to drop something onto the app icon. There are examples of dropping things to the app, but how do I get the icon to react to dropping?
Adding the event listener
models.application.addEventListener('dropped', function() {
doSomething();
});
doesn't seem to do it. Other apps have it though, so there is a way.
You need to add the AcceptedLinkTypes attribute to the manifest.json file of your Spotify app.
For instance, if your app wants to react to drag&drop of playlists, you would do:
{
"AcceptedLinkTypes": ["playlist"],
...
}
Currently, album, artist, playlist, track and user are supported.
If the changes in AcceptedLinkTypes don't take any effect, try restarting the client.

Display one time welcome screen titanium

I am working on titanium [new to this platform], I am using Titanium 3.1.0 version Alloy.
display one time welcome screen.
welcome screen name is IndexWindow next screen is LoginWindow.
when i relaunch the application it need to show loginWindow. not IndexWindow[welcome Screen].
Where i need to do changes for this?
# all
Thanks in advance
To solve this you'll need to persist the info by using properties like this :
if(Ti.App.Properties.hasProperty('loggedBefore')) {
// open login window
} else {
Ti.App.Properties.setString('loggedBefore', '1');
// open indexWindow
}