Where to put test device IDs in google_mobile_ads package? - flutter

I was using firebase_admob package where I could add the test devices IDs with:
var targetingInfo = MobileAdTargetingInfo(
testDevices: <String> [...]
);
But with google_mobile_ads I couldn't find anything similar to that. So, where can I put the test device IDs? Am I only left with using the test Ad unit?

Use updateRequestConfiguration callback on the MobileAds instance, and provide test device IDs.
MobileAds.instance
..initialize()
..updateRequestConfiguration(RequestConfiguration(
testDeviceIds: <String>[],
));

Related

Why is flutter_siren reporting null values?

Trying to use flutter_siren 1.2.0
After I check permissions, I do
Final Siren siren=Siren();
String myver = await siren.localVersion;
But... siren.localversion is... null. I have it in my pubspec.yaml (Android) and the app is published to play store...
What am I missing?

Flutter : How to Allow any device to create a single account only

i am working in flutter app,
I want each user to create only one account through his device
That is, banning the device from creating other accounts for two days
After two days, the user can create another account only, and so on,
in my case : save device id or token and date Time in firebase and before create account app check if this device was registered or not if registered check time , this way is right ?
and how can i get device id or any constant number from device ?
thanks
I'm sorry, I think I may not have fully grasped your question, here's my guess about what you are asking based on the agglomeration of English words you've put:
You are using Flutter to develop the front-end of an application while using Firebase for the back-end. You want to make sure that each device could only create one account every 48 hours. Please correct me if my understanding is wrong.
There's never a unique solution to those kind of questions, and I think your approach (timestamp + some ID that tells devices apart) is a decent one.
To get the device ID, it looks like you can use the device_info_plus plugin according to here: How to get unique device id in flutter?
You need to find and store unique device ID in the database.
You can find unique device using this plugin
dependencies:
device_info_plus: ^3.2.3
Create a method:
Future<String?> _getId() async {
var deviceInfo = DeviceInfoPlugin();
if (Platform.isIOS) { // import 'dart:io'
var iosDeviceInfo = await deviceInfo.iosInfo;
return iosDeviceInfo.identifierForVendor; // unique ID on iOS
} else if(Platform.isAndroid) {
var androidDeviceInfo = await deviceInfo.androidInfo;
return androidDeviceInfo.androidId; // unique ID on Android
}
}

Flutter Web UUID Unique Identifier

How can I get UUID in Flutter Web.
I need some unique identifier in order to keep record of devices useb by customer,my testing device,develeper device.
In android, I'm using device_info_plugin.
How can I get Unique identifier in Web?
Thanks in Advance
You can use platform_device_id to get the browser details.
For browser info, you can use it as
import 'package:platform_device_id/platform_device_id.dart';
String? deviceId = await PlatformDeviceId.getDeviceId;
print($deviceId);
OR
hare is the Answer to the approach to set a custom uuid for flutter web

Which of the MobileAdTargetingInfo properties of Flutter Firebase AdMob package do I need for release?

I want to know when using firebase_admob, do I need this code?
If so, when releasing an app, what should I write for keywords, contentUrl, and testDevices?
I mean, when releasing an app, testDevices is even necessary?
MobileAdTargetingInfo targetingInfo = MobileAdTargetingInfo(
keywords: <String>['flutterio', 'beautiful apps'],
contentUrl: 'https://flutter.io',
birthday: DateTime.now(),
childDirected: false,
designedForFamilies: false,
gender: MobileAdGender.male, // or MobileAdGender.female, MobileAdGender.unknown
testDevices: <String>[], // Android emulators are considered test devices
);
this information is used to show ad to users.
You should use keywords related to your application. Ex: if Your application is related to hospital then you can use medicine as your key words.
you can add you web site url if you develop any web site for particular application as contentUrl .
testDevices is a Id of you device in which you are tested. if you want to test your application in real device then you must add test device id because it help you to avoid ad mob bane.
MobileAdTargetingInfo class properties mirror the native AdRequest API.
You will find more information about those properties in the documentation for AdRequest.Builder and RequestConfiguration.Builder.
AdRequest.Builder
public AdRequest.Builder addKeyword (String keyword)
Add a keyword for targeting purposes.
public AdRequest.Builder setContentUrl (String contentUrl)
Sets the content URL for a web site whose content matches the app's primary content. This web site content is used for targeting and brand safety purposes.
At the time of writing some parameters from the question have been deprecated with no alternative, some like the one below replaced with a different approach, while some other moved to RequestConfiguration.Builder.
public AdRequest.Builder setIsDesignedForFamilies (boolean isDesignedForFamilies)
Deprecated. Use Ad Content Filtering.
RequestConfiguration.Builder
public RequestConfiguration.Builder setTagForChildDirectedTreatment (int tagForChildDirectedTreatment)
This method allows you to specify whether you would like your app to be treated as child-directed for purposes of the Children’s Online Privacy Protection Act (COPPA)
public RequestConfiguration.Builder setTestDeviceIds (List testDeviceIds)
Sets a list of test device IDs corresponding to test devices which will always request test ads. The test device ID for the current device is logged in logcat when the first ad request is made.

Unity3d Facebook AppRequest filter

In my Unity project for IOS i use
FB.AppRequest(
message: "somedesc",
title: "sometitle",
callback:appRequestCallback );
I want filter and show only friends who don't install app, but filters = ["app_users"] and
excludeIds = "someIdValue" not working
How solved this problem
(I use Facebook Unity SDK, https://developers.facebook.com/docs/unity)
You can use this:
// "app_non_users" will list friends that haven't installed the game yet
List<object> filter = new List<object>() { "app_non_users" };
// Then, call the API with this filter. Enjoy!
FB.AppRequest("Test Message", null, filter, null, 0, string.Empty, string.Empty, this.HandleResult);
In the examples that are provided within the Facebook SDK for Unity, there's a scene called AppRequests. From there, I've seen a class named AppRequests.cs, in which you can find several examples on how to use these app requests.
Note: To try this examples, make sure to add all FacebookSDK provided scenes to your build settings scenes. Test them in device.
FB Unity SDK documentation says that filters are currently supported:
Filter are currently not supported for mobile devices
You should probably get list of friends first with a request like this with FB.API method:
FB.API ("/me/friends?installed=false", HttpMethod.GET, Callback, null);