For users who want to buy a car, if they are walking on the road and swiping social software, they suddenly receive an advertisement in the app: "A car of a certain brand in the business district 500 meters ahead is offering discounts, with great strength and great benefits." No matter whether you buy it or not If you buy it, 80% of them will go to see it. There are three reasons: close distance, matching demand, and discount. Then this is a successful advertisement. The most important thing in advertising is to find key customer target groups. Therefore, marketers of various apps are thinking about how to place advertisements online and tap the space of high-value marketing in order to achieve advertising effects. maximize.
It is very important to capture the crowd information every time. Mobile location data can directly reflect the actual consumption activities of users. For example, white-collar workers in office buildings like to order takeaways, hipsters in business circles like younger entertainment activities, and rich people in villa areas like luxury goods. , luxury cars, etc., user attributes can be extracted through location information, and advertisement matching can be performed.
HMS Core provides the ability to request advertisements based on geographic location , and developers can quickly integrate them in applications. The advantage of this type of advertisement is that it can provide targeted marketing content that is directly related to consumers' scenarios. For example, when users browse social apps near the business district, some brands with offline stores will push them in the form of native advertisements in the app, and attract users to buy by issuing coupons; near schools, parents wait for their children to watch news after school. When using the app, educational institutions can push courses in the form of patch advertisements to attract users precisely; when users go to a new city for business, they can see the local gourmet restaurant recommending it in the form of on-screen advertisements when they open the takeaway app.
In order to push ads more efficiently and accurately, the HUAWEI Ads SDK will carry location information when requesting ads based on whether your app has location permissions to help you increase ad conversion effects and increase monetization revenue.
Development steps
Specify app permissions
1.Android provides two location permissions: ACCESS_COARSE_LOCATION (coarse location permission) and ACCESS_FINE_LOCATION (precise location permission). Permissions need to be configured in the "AndroidManifest.xml" file:
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
2. (Optional) In Android 10 and above, if you want the app to have continuous location capability even when the app is running in the background, you need to configure the ACCESS_BACKGROUND_LOCATION permission in the "AndroidManifest.xml" file:
<uses-permission
android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />
Dynamically apply for location-related permissions (dangerous permission requirements for Android 6.0 and above):
// Android SDK<=28 所需权限动态申请 if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.P) { Log.i(TAG, "android sdk <= 28 Q"); if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) { String[] strings = {Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.ACCESS_COARSE_LOCATION}; ActivityCompat.requestPermissions(this, strings, 1); } } else { // Android SDK>28 所需权限动态申请,需添加“android.permission.ACCESS_BACKGROUND_LOCATION”权限 if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, "android.permission.ACCESS_BACKGROUND_LOCATION") != PackageManager.PERMISSION_GRANTED) { String[] strings = {android.Manifest.permission.ACCESS_FINE_LOCATION, android.Manifest.permission.ACCESS_COARSE_LOCATION, "android.permission.ACCESS_BACKGROUND_LOCATION"}; ActivityCompat.requestPermissions(this, strings, 2); } }
If the application applies for and obtains the location permission from the user, the SDK will carry the location information by default; if the application does not want to carry the location information when requesting an advertisement, it can also call the API setRequestLocation() to set whether to carry it.
// 以banner广告为例,不携带位置信息
AdParam adParam = new AdParam.Builder()
// 请求时是否携带位置信息,true:是;false:否。默认为true;
.setRequestLocation(false)
.build();
bannerView.loadAd(adParam);
Learn more details>>
Visit the official website of Huawei Developer Alliance
Get development guidance documents
Huawei Mobile Services Open Source Warehouse Address: GitHub , Gitee
Follow us to know the latest technical information of HMS Core for the first time~
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。